{% extends 'BWLwebshopBundle:Admin:base.html.twig' %}

{% block body %}



    <h1> ABC - Analyse</h1>
    <h2>Bitte wähle einen Zeitraum</h2>
    <form action="{{ path('bwl_webshop_abcAnalysis') }}"
          method="post" {{ form_enctype(form) }}>
        {{ form_widget(form) }}
        <input type="submit"/>
    </form>
    <br \>
    <article class="box">
        <header><h3>Vom: {{ form.vars.value.from|date('d.m.Y') }}
            Bis: {{ form.vars.value.to|date('d.m.Y') }}</h3></h2></header>
        <div style="float: left">
            <table class="dottedlight">
                <tr>
                    <th>Produkte</th>
                    <th>Wert</th>
                </tr>
                {% for product in products %}
                    <tr>
                        <td>{{ product.name }}</td>
                        <td style="text-align: right">{{ product.value }} €</td>
                    </tr>
                {% endfor %}
            </table>
        </div>

        <div style="float: right">
            <table class="dottedlight">
                <tr>
                    <th>Produkte</th>
                    <th>Wert</th>
                    <th>Summe</th>
                    <th>Prozent</th>
                    <th>Klasse</th>
                </tr>
                {% set sum = 0 %}
                {% for product in products_sum %}
                    <tr>
                        <td>{{ product.name }}</td>
                        <td style="text-align: right">{{ product.value|number_format(2, ',', '.') }} &euro;</td>
                        <td>{% set sum = sum + product.value %}{{ sum|number_format(2, ',', '.') }} &euro;</td>
                        <td>{{ product.percent|number_format(2, ',', '.') }}</td>
                        <td>{{ product.class }}</td>
                    </tr>
                {% endfor %}
            </table>
        </div>
    </article>



{% endblock %}